package com.xbenben.demo;


/**
 * @author admin001
 */

public enum DataEnum {

    /**
     * static             tb_static_user_day        1
     * user               tb_user                   2
     * action_info        tb_action_info            3
     * action_post        tb_action_post            4
     * category           tb_category               5
     */
    TB_STATIC_USER_DAY("1", "static"),
    TB_USER("2", "user"),
    TB_ACTION_INFO("3", "action_info"),
    TB_ACTION_POST("4", "action_post"),
    TB_CATEGORY("5", "category");

    private final String index;
    private final String name;


    DataEnum(String index, String name) {
        this.index = index;
        this.name = name;
    }


    public static String getName(String index) {

        for (DataEnum accruedCleanEnum : DataEnum.values()) {
            if (accruedCleanEnum.getIndex().equals(index)) {
                return accruedCleanEnum.name;
            }
        }
        return "";
    }

    /**
     * 根据 名称 获取 下标
     *
     * @param name
     * @return
     */
    public static String getIndex(String name) {


        for (DataEnum accruedCleanEnum : DataEnum.values()) {
            if (accruedCleanEnum.getName().equals(name)) {
                return accruedCleanEnum.index;
            }
        }

        return "";
    }


    public String getIndex() {
        return index;
    }


    public String getName() {
        return name;
    }

}
